.system-management-container {
  padding: 1rem;
}

// 添加功能弹窗样式
::ng-deep .add-function-dialog {
  .nb-dialog-container {
    width: 800px !important;
    max-width: 90vw !important;
  }
  
  .nb-dialog {
    width: 100% !important;
  }
}

// 编辑功能弹窗样式
::ng-deep .edit-function-dialog {
  .nb-dialog-container {
    width: 800px !important;
    max-width: 90vw !important;
  }
  
  .nb-dialog {
    width: 100% !important;
  }
}


.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
}

.page-header {
  margin-bottom: 1.5rem;
}

.active-cluster-info {
  text-align: right;
  
  .cluster-name {
    font-weight: 600;
    color: var(--text-basic-color);
  }
}

.cluster-info {
  .cluster-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: nb-theme(text-basic-color);
  }
  
  small {
    font-size: 0.75rem;
    color: nb-theme(text-hint-color);
  }
}

.header-separator {
  color: nb-theme(text-hint-color);
  font-weight: 300;
}

.cluster-name-small {
  font-size: 0.8em;
  font-weight: 400;
  color: nb-theme(text-hint-color);
}

.categories-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.category-card {
  transition: all 0.3s ease;
  border-radius: 0.5rem;
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
  
  &.cdk-drag-preview {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: rotate(2deg);
  }
  
  &.cdk-drag-placeholder {
    opacity: 0.4;
  }
  
  &.cdk-drag-animating {
    transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
  }
  
  nb-card-header {
    background-color: var(--background-basic-color-2);
    border-bottom: 1px solid var(--border-basic-color-3);
  }
  
  .category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    h3 {
      font-size: 1rem;
      font-weight: 600;
      color: var(--text-basic-color);
    }
    
    nb-icon {
      color: var(--text-hint-color);
    }
    
    .drag-handle {
      cursor: grab;
      opacity: 0.4;
      transition: opacity 0.2s ease;
      color: var(--text-hint-color);
      
      &:hover {
        opacity: 0.8;
      }
    }
  }
  
  // 为每个分类添加左边框标识,而不是整个卡片背景色
  &[data-category="集群信息"] nb-card-header {
    border-left: 3px solid var(--color-info-500);
  }
  
  &[data-category="数据库管理"] nb-card-header {
    border-left: 3px solid var(--color-success-500);
  }
  
  &[data-category="事务管理"] nb-card-header {
    border-left: 3px solid var(--color-warning-500);
  }
  
  &[data-category="任务管理"] nb-card-header {
    border-left: 3px solid var(--color-primary-500);
  }
  
  &[data-category="元数据管理"] nb-card-header {
    border-left: 3px solid var(--border-basic-color-4);
  }
  
  &[data-category="存储管理"] nb-card-header {
    border-left: 3px solid var(--color-danger-500);
  }
  
  &[data-category="作业管理"] nb-card-header {
    border-left: 3px solid var(--color-control-default);
  }
}

.functions-list {
  min-height: 100px;
}

.function-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-basic-color-2);
  border-radius: 0.375rem;
  background: var(--background-basic-color-1);
  cursor: pointer;
  transition: all 0.2s ease;
      
  &:hover {
    background: var(--background-basic-color-2);
    border-color: var(--border-basic-color-4);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
  
  &.system-function {
    background: var(--background-basic-color-1);
    border-left: 2px solid var(--color-success-400);
    
    &:hover {
      border-left-color: var(--color-success-500);
    }
  }
  
  &.cdk-drag-preview {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: rotate(1deg);
    border: 1px solid var(--border-basic-color-4);
  }
  
  &.cdk-drag-placeholder {
    opacity: 0.3;
    background: var(--background-basic-color-2);
  }
  
  &.cdk-drag-animating {
    transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
  }
}

.function-info {
  flex: 1;
  
  h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-basic-color);
  }
  
  p {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    color: var(--text-hint-color);
    line-height: 1.3;
  }
}

.function-meta {
      display: flex;
      align-items: center;
  font-size: 0.75rem;
  color: var(--text-hint-color);
  
  .last-updated {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }
}

.function-actions {
      display: flex;
  align-items: center;
  gap: 0.25rem;
  
  .drag-handle {
    cursor: grab;
    opacity: 0.6;
    transition: opacity 0.2s ease;
        
        &:hover {
      opacity: 1;
    }
  }
  
  button.favorited {
    color: var(--color-warning-500) !important;
    background: var(--color-warning-100) !important;
  }
}

.arrow-icon {
  color: var(--text-hint-color);
  transition: color 0.2s ease;
  
  &.system-arrow {
    color: var(--color-success-500);
  }
}

.function-item:hover .arrow-icon {
  color: var(--color-primary-500);
}

.detail-view {
  .header-separator {
    color: var(--text-hint-color);
    margin: 0 0.5rem;
  }
}

.search-section {
  .form-control {
    border-radius: 0.375rem;
  }
}

// CDK Drag and Drop 全局样式
.cdk-drag-preview {
  box-sizing: border-box;
  border-radius: 4px;
  box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
              0 8px 10px 1px rgba(0, 0, 0, 0.14),
              0 3px 14px 2px rgba(0, 0, 0, 0.12);
}

.cdk-drag-placeholder {
  opacity: 0;
}

.cdk-drag-animating {
  transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}

.cdk-drop-list-dragging .cdk-drag:not(.cdk-drag-placeholder) {
  transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}

// 响应式设计
@media (max-width: 768px) {
  .categories-container {
    grid-template-columns: 1fr;
  }
  
  .page-header {
    .d-flex {
      flex-direction: column;
      align-items: flex-start !important;
      gap: 1rem;
    }
  }
  
  .active-cluster-info {
    text-align: left;
  }
}

// 暗色主题适配
:host-context(.dark-theme) {
  .function-item {
    background: var(--background-basic-color-1);
    border-color: var(--border-basic-color-3);
    
    &:hover {
      background: var(--background-basic-color-2);
    }
  }
}